function randStrCore() {
  return Math.random().toString(36).substr(2)
}

export function randString(length = 16) {
  let str = ''
  while (str.length < length) {
    str += randStrCore()
  }
  return str.substr(0, length)
}

export function minus(a, b) {
  if (typeof a === 'string') {
    if (a > b) {
      return 1
    } else if (a < b) {
      return -1
    } else {
      return 0
    }
  } else if (typeof a === 'number') {
    return a - b
  } else {
    return 0
  }
}
